package com.cloud.logger.zchain.zchainserver.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.cloud.logger.zchain.zchainserver.entity.propertyenum.SwitchEnum;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;

/**
 * @ClassName: AngelaLoggerProjectDtail
 * @author: wcy
 * @return:
 * @Decription: 项目的详细操作信息
 * @CreateDate: 2017/12/4
 */
@Data
@Document(collection = "logger_project_node")
public class AngelaLoggerProjectNode {

    @Id
    private String id;

    @JsonProperty("code")
    @JSONField(name = "code")
    @ApiModelProperty(name = "code", notes = "编码", example = "1")
    private String code;

    @JsonProperty("ip")
    @JSONField(name = "ip")
    @ApiModelProperty(name = "ip", notes = "安装ip地址", example = "10.0.0.1")
    private String ip;

    @JsonProperty("port")
    @JSONField(name = "port")
    @ApiModelProperty(name = "port", notes = "端口", example = "8080")
    private String port;

    @JsonProperty("create_time")
    @JSONField(name = "create_time", format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(name = "create_time", notes = "创建时间", example = "2017-12-04 15:18:11")
    private Date createTime;

    @JsonProperty("status")
    @JSONField(name = "status")
    @ApiModelProperty(name = "status", notes = "项目情况(off/on)", example = "off")
    private SwitchEnum status;

    @Transient
    @ApiModelProperty(name = "status", notes = "项目生存情况", example = "（3/2）")
    private String statusStr;

    @ApiModelProperty(hidden = true)
    private long version;

    @ApiModelProperty(hidden = true)
    private long createBy;

    @Transient
    @ApiModelProperty(hidden = true)
    private String scenic;

    @JsonProperty("message_forbidden")
    @JSONField(name = "message_forbidden")
    @ApiModelProperty(name = "message_forbidden", notes = "短信禁用(off/on)", example = "off")
    private SwitchEnum messageForbidden;

    @JsonProperty("mail_forbidden")
    @JSONField(name = "mail_forbidden")
    @ApiModelProperty(name = "mail_forbidden", notes = "邮件禁用(off/on)", example = "off")
    private SwitchEnum mailForbidden;

//    public void setStatus(SwitchEnum status){
//        setStatusStr(status.getName());
//        this.status = status;
//    }
}
